#!/bin/bash

if [[ $(id -u) != 0 ]]; then
    echo "Please run as root or use sudo"
    exit 1
fi

set -e

apt-get install -y wget
CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME")
echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian ${CODENAME} pve-no-subscription" \
	> /etc/apt/sources.list.d/pve-install-repo.list

wget http://download.proxmox.com/debian/proxmox-release-bullseye.gpg \
	-O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg

chmod +r /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg

